{// 加载头部公共文件 }
<include file="Public:header" />
<script>
$(function(){
	$("#loadimg").on("click",function(){
		var img=$("#verifyImg");	
		img.attr("src",img.attr("src")+"&rand="+Math.random());
	})
	$("form").submit(function(){
		$(".fade").find("h4").html("");
		$("[type='submit']").val("正在保存");
		var self = $(this);
		$.post(self.attr("action"), self.serialize(), success, "json");
		return false;

		function success(data){
			if(data.status){
				$(".fade").find("h4").html("修改成功！").css("color","green");
				$("[type='submit']").val("马上保存");
				//window.location.href = data.url;
			} else {
				$(".fade").find("h4").html(data.info).css("color","red");
				//刷新验证码
				$("#verifyImg").click();
				$("[type='submit']").val("立即保存");
			}
		}

	})
})
</script>
<div class="container">
<div class="panel panel-primary">
		<div class="panel-heading"><strong>修改个人信息</strong></div>
		<div class="panel-body">
		<div class="row">
		<form class="form-horizontal" method="post" action="{:U('home/user/dosave/')}">
		<input type="hidden" value="{$model.uid}" name="uid"/>
		  <div class="form-group row">
			<label for="username" class="col-sm-2 control-label">用户名</label>
			<div class="row">
				<div class="col-xs-3">
				<input type="text" name="username" class="form-control"
				 placeholder="用户名" value="{$model.username}" />
				 </div>
				 <div class="col-xs-4"><span class="help-block" id="username">中英文均可，4~16位</span>
				 </div>
			</div>
		  </div>
		  
		  <div class="form-group">
			<label for="pwd" class="col-sm-2 control-label">性别</label>
			<div class="col-sm-4">
				<label class="checkbox-inline">
				  <input type="radio" id="type0" name="type" value="0" <eq name="model.type" value="0" >checked</eq>> 男
				</label>
				<label class="checkbox-inline">
				  <input type="radio" id="type1" name="type" value="1" <eq name="model.type" value="1" >checked</eq>> 女
				</label>
			</div>
		  </div>
		  <div class="form-group">
			<label for="truename" class="col-sm-2 control-label" >真实姓名</label>
			<div class="row">
				<div class="col-xs-3">
				<input type="text" name="truename" class="form-control"
				 placeholder="真实姓名"  value="{$model.truename}"/>
				 </div>
				 <div class="col-xs-4"><span class="help-block">请填写真实姓名</span>
				 </div>
			</div>
		  </div>
		  <div class="form-group">
			<label for="id" class="col-sm-2 control-label">身份证</label>
			<div class="row">
				<div class="col-xs-3">
				<input type="text" name="id" class="form-control"
				 placeholder="身份证" value="{$model.id}"/>
				 </div>
				 <div class="col-xs-4"><span class="help-block">请填写身份证</span>
				 </div>
			</div>
		  </div>
		  
		  <div class="form-group">
			<label for="cardid" class="col-sm-2 control-label">医保号</label>
			<div class="row">
				<div class="col-xs-3">
				<input type="text" name="cardid" class="form-control"
				 placeholder="医保号" value="{$model.cardid}" />
				 </div>
				 <div class="col-xs-4"></div>
			</div>
		  </div>
		  
		  <div class="form-group">
			<label for="mobile" class="col-sm-2 control-label">手机号</label>
			<div class="row">
				<div class="col-xs-3">
				<input type="text" name="mobile" class="form-control"
				 placeholder="手机号" value="{$model.mobile}"/>
				 </div>
				 <div class="col-xs-4"><span class="help-block">请填写手机号</span></div>
			</div>
		  </div>
		  
		  <div class="form-group">
			<label for="address" class="col-sm-2 control-label">地址</label>
			
			<div class="row">
				<div class="col-xs-6">
				<textarea class="form-control" row="4" name="address">{$model.address}</textarea>
				</div>
			</div>
		  </div>
		  <div class="form-group">
			<label for="verify" class="col-sm-2 control-label">验证码</label>
			<div class="row">
				<div class="col-xs-2">
				<input type="text" name="verify" class="form-control"
				 placeholder="验证码" />
				 </div>
				 <div class="col-xs-2"><img class="code" id="verifyImg" style="height:32px;" src="{:U('home/public/verify')}" onclick="this.src+='&rand='+Math.random();" alt="点击刷新验证码" /> <a href="#" id="loadimg">看不清?</a>
				 </div>
			</div>
		  </div>
		  <div class="form-group">
			<div class="col-sm-offset-2 col-sm-10">
			  <div class="row">			  
				  <div class="col-xs-2">
				  <input class="btn btn-primary" type="submit" value=" 马上保存 "/>
				  </div>				  
				  <div class="col-xs-4" id="tip">
					  <div class="fade in">					  
						<h4></h4>
					  </div>
				  </div>
			  </div>
			</div>
		  </div>
		</form>
		</div>
    </div>
	</div>
</div>

</div> <!-- /container -->

<!-- 主页面结束 -->
{// 加载尾部公共文件 }
<include file="Public:footer" />